<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="">
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <title>提现</title>
    <link href="../../css/css.css" rel="stylesheet" type="text/css">
    <script src="../../js/jquery-v1.11.2.min.js"></script>
    <script src="../../js/driver.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<section class="subtitle mt10 p15">银行信息</section>
<form id="drawForm" method="post">
    <section class="itemgroup p15">
        <div class="inputarea">
            <label class="inputnamebig">银行卡号</label>
            <label class="inputformbig">
                <i class="iconfont wipe">&#xe614;</i>
                <input class="formstyle w100" type="text" placeholder="请输入银行卡号" name="accountNum" id="accountNum"/>
            </label>
        </div>
        <div class="inputarea">
            <label class="inputnamebig">银行名称</label>
            <label class="inputformbig">
                <i class="iconfont wipe">&#xe614;</i>
                <input class="formstyle w100" type="text" placeholder="请输入银行名称" name="bankName" id="bankName"/>
            </label>
        </div>
        <div class="inputarea">
            <label class="inputnamebig">开户分行</label>
            <label class="inputformbig">
                <i class="iconfont wipe">&#xe614;</i>
                <input class="formstyle w100" type="text" placeholder="请输入开户分行名称" name="bankBranchName"
                       id="bankBranchName"/>
            </label>
        </div>
        <div class="inputarea">
            <label class="inputnamebig">开户人姓名</label>
            <label class="inputformbig">
                <i class="iconfont wipe">&#xe614;</i>
                <input class="formstyle w100" type="text" placeholder="请输入开户人姓名" name="accountName" id="accountName"/>
            </label>
        </div>
    </section>
</form>
<section class="bottomarea">
    <button type="button" class="btn bottomonebtn" onclick="commitAccountDraw()">提交</button>
</section>
<script type="text/javascript">
    $(function () {
        //token验证
        checkDriverToken();
    });
    $(document).ready(function () {
        var url = _global.serverHost + "/capital/driver/accountView.htm";
        var data = {driverUuid: getCookie("driverUuid")};
        _callAjaxRequest(url, data, startBidBack);

        function startBidBack(data) {
            if (data.payAccount != null) {
                $("#accountNum").val(data.payAccount.accountNum);
                $("#bankName").val(data.payAccount.bankName);
                $("#bankBranchName").val(data.payAccount.bankBranchName);
                $("#accountName").val(data.payAccount.accountName);
            }
        }

    });
    function commitAccountDraw() {
        var accountNum = $("#accountNum").val();
        if (accountNum == null || accountNum == '') {
            alert("请输入银行卡号");
            return false;
        }
        var bankName = $("#bankName").val();
        if (bankName == null || bankName == '') {
            alert("请输入银行名称");
            return false;
        }
        var bankBranchName = $("#bankBranchName").val();
        if (bankBranchName == null || bankBranchName == '') {
            alert("请输入开户分行名称");
            return false;
        }
        var accountName = $("#accountName").val();
        if (accountName == null || accountName == '') {
            alert("请输入开户人姓名");
            return false;
        }
        $.ajax({
            type: "POST",
            url: _global.serverHost + "/capital/driver/account.htm?driverUuid=" + getCookie("driverUuid"),
            data: $("#drawForm").serialize(),
            contentType: "application/x-www-form-urlencoded;charset=UTF-8",
            success: function (data) {
                if (data.code == "1") {
                    window.location.href = "../../driver/me/me.html";
                } else {
                    alert(data.message);
                }
            }
        });
    }
</script>
</body>
</html>